import { createApp } from 'vue';
import './style.css';
import App from './App.vue';

import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

import './theme/theme.less';

import router from './router';
import ElementPlus from 'element-plus';
import { ElMessage } from 'element-plus';
import 'element-plus/dist/index.css';
import 'virtual:svg-icons-register';

import 'highlight.js/styles/atom-one-dark.css'
import 'highlight.js/lib/common'
import hljsVuePlugin from "@highlightjs/vue-plugin";

import moment from 'moment'
import 'moment/dist/locale/zh-cn'
moment.locale('zh-cn') //中文化

// 引入 theia-sticky-sidebar 智能侧边栏跟随效果库
import 'theia-sticky-sidebar';
// websocket服务
import '@/utils/websocket';
//全局组件
import SvgIcon from "@/components/SvgIcon/index.vue"
import UserCard from "@/components/UserCard/index.vue"
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate)

app
.provide('message', ElMessage)
.provide('route', router)
.component('SvgIcon', SvgIcon) // 全局组件
.component('UserCard', UserCard) // 全局组件
.use(pinia) // 状态管理
.use(hljsVuePlugin) // 代码高亮
.use(router) // 路由
.use(ElementPlus) // elementui框架
.mount('#app')
